<?php
/**
 *
 * 获取唯一主键
 *
 */

class UUIDUtil{

	/**
	 * 构造方法
	 */
	public function __construct(){

	}

	/**
	 * 生一个不重复的ID
	 */
	public static function getOneUUID(){
		$chars = md5(uniqid(mt_rand(), true));
		$uuid  = substr($chars,0,8) . '-';
		$uuid .= substr($chars,8,4) . '-';
		$uuid .= substr($chars,12,4) . '-';
		$uuid .= substr($chars,16,4) . '-';
		$uuid .= substr($chars,20,12);
		return $uuid;
	}

	 

}